#ifndef IRENDERENGINE_H
#define IRENDERENGINE_H

#include "Framework/Prerequisites.h"

#include "Math/Matrix4.h"
#include "Graphics/Colour.h"

namespace tyro
{
	namespace Graphics
	{

		class IRenderEngine
		{
		public:

			IRenderEngine();
			virtual ~IRenderEngine();

			virtual void Update();
			virtual IRenderWindow* Initialise(const char* const title = "tyro");

			virtual void ClearFrameBuffer( UINT32 buffers, const Colour& colour = Colour::Black, FLOAT_32 depth = 1.0f, UINT16 stencil = 0.0f) = 0;
			virtual void BlindVertexElementToDevice(const VertexElement& elem, IDeviceVertexBufferSharedPtr vertexBuffer, size_t vertexStart) = 0;
			virtual void SetPolygonMode( PolygonMode polygonMode ) = 0;
			virtual void SetProjectionMatrix(const Math::Matrix4f& matrix) = 0;
			virtual void SetViewMatrix(const Math::Matrix4f& matrix) = 0;
			virtual void SetWorldMatrices(const Math::Matrix4f* matrices, USHORT_16 numMatrices);
			virtual void SetWorldMatrix(const Math::Matrix4f& matrix) = 0;
			virtual void SetDepthBuffer(bool depthTest, bool depthMask) = 0;
			virtual void SetDepthBufferTest(bool enabled) = 0;
			virtual void SetDepthBufferMask(bool enabled) = 0;
			virtual void SetNormaliseNormals(bool enabled) = 0;
			virtual void SetCullingMode(CullingMode mode) = 0;
			virtual void SetRenderTarget(IRenderTarget* renderTarget) = 0;
			virtual void SetRunLog(Framework::LogFile* runLog);
			virtual void UpdateRenderTarget();
			virtual	void AttachRenderTarget( IRenderTarget &renderTarget );
			virtual void SwapRenderTargetBuffers();
			virtual void InitDeviceCapabilities() = 0;
			virtual void SetViewport(IViewport *vp) = 0;
			virtual void SetColour(Graphics::Colour colour) = 0;
			virtual void SetSurfaceParams(const Colour &ambient,
										const Colour &diffuse, const Colour &specular,
										const Colour &emissive, FLOAT_32 shininess)=0;
			virtual void SetLightingActive(bool enabled) = 0;
			virtual void SetAmbientLight(FLOAT_32 r, FLOAT_32 g, FLOAT_32 b) = 0;
			virtual IDeviceBufferManager* GetDeviceBufferManager();

			virtual void DrawTriangle() = 0;
			virtual void translate(Math::Vector3f vec) = 0;

			virtual void RenderOperation(const IRenderOperation& op);
			virtual void BeginFrame(void) = 0;
			virtual void EndFrame(void) = 0;



		protected:


			Framework::LogFile*					runLog;
			OS::IWindowManager*					windowManager;
			Graphics::IRenderWindow*			renderWindow;
			Graphics::IViewport*				activeViewport;
			Graphics::IRenderTarget*			activeRenderTarget;
			Graphics::IDeviceBufferManager*	bufferManager;

			Math::Matrix4f						viewMatrix;
			Math::Matrix4f						worldMatrix;

			CullingMode activeCullingMode;

		private:

			
		};

		

	}

}
#endif